﻿using AutoMapper;
using MediatR;
using Microsoft.AspNetCore.Mvc;
using SheepStorage.API.Application.Command.YourTableNameCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Dto;
using SheepStorage.Domain.DTO.Output;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandler
{
    public class YourTableNameShowCommandHandler : IRequestHandler<YourTableNameShowCommand, Results<PageOutput<DawningSheepDto>>>
    {
        private readonly IYourTableNameService _yourTableName;
        public YourTableNameShowCommandHandler(IYourTableNameService yourTableName)
        {
            _yourTableName = yourTableName;
        }

        public async Task<Results<PageOutput<DawningSheepDto>>> Handle(YourTableNameShowCommand request, CancellationToken cancellationToken)
        {
            return Results<PageOutput<DawningSheepDto>>.DataResult(await _yourTableName.GetYourTableNames(request.OverBit,request.DawningsheepType,request.index,request.size));
        }
    }
}
